﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.Skins;
using DevExpress.LookAndFeel;
using DevExpress.UserSkins;
using DevExpress.XtraBars;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraBars.Helpers;

namespace NotebookS2
{
    public partial class MainMenu : RibbonForm
    {
        public MainMenu()
        {
            InitializeComponent();
        }

        
        public Login LoginWindow { get; set; }
        public string Company { get; set; }
        public string ConnectionString { get; set; }
        public string ActiveUserID { get; set; }
        public string UserName { get; set; }
        public string AccessCode { get; set; }

        public bool IsMultipleWarehouse { get; set; }
        public string DefaultWarehouse { get; set; }

        public string Department { get; set; }
        

        

        public void ApplyAccessCode()
        {
            switch (this.AccessCode)
            {
                case "2":
                    navPurAP.Visible = true;
                    navSalesAR.Visible = false;
                    navInventory.Visible = false;
                    break;
                case "3":
                    navPurAP.Visible = false;
                    navSalesAR.Visible = true;
                    navInventory.Visible = false;
                    break;
                case "4":
                    navPurAP.Visible = false;
                    navSalesAR.Visible = false;
                    navInventory.Visible = true;
                    break;
            }
        }

        void DisableBars()
        {
            barAddBank.Enabled = false;
        }

        private void MainMenu_Load(object sender, EventArgs e)
        {

            Login oLogin = new Login();

            oLogin.MainForm = this;
            oLogin.IsAlreadyOpen = false;
            oLogin.ShowDialog();

            try
            {
                barStaticCompany.Caption = this.Company;
                barStaticUser.Caption = "User ID: " + this.ActiveUserID.ToUpper();
            }
            catch
            {
                Application.Exit();
            }
        }

        private void barItemMasterData_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_ITEMMASTER oForm = new M_ITEMMASTER();

            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void barSearchDocument_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                SalesInvoice oForm = (SalesInvoice)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.ShowSearch();

            }
            catch
            {
            }
            try
            {
                APCounterDocument oForm = (APCounterDocument)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                
                oForm.ShowSearch();

            }
            catch
            {
            }

            try
            {
                APVoucherDocument oForm = (APVoucherDocument)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;

                oForm.ShowSearch();

            }
            catch
            {
            }

            try
            {
                AcknowledgementReceipt oForm = (AcknowledgementReceipt)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.ShowSearch();

            }
            catch
            {
            }

            
            try
            {
                ConsignmentTransfer oForm = (ConsignmentTransfer)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();

            }
            catch
            {
            }
            try
            {
                ConsignmentOrder oForm = (ConsignmentOrder)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();

            }
            catch
            {
            }
            try
            {
                CustomerInfo oForm = (CustomerInfo)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();

            }
            catch
            {
            }
            try
            {
                JournalEntry oForm = (JournalEntry)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();

            }
            catch
            {
            }
            try
            {
                JournalVoucher oForm = (JournalVoucher)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();

            }
            catch
            {
            }

            try
            {
                M_USERPOLICY oForm = (M_USERPOLICY)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }

            try
            {
                ARDebitMemo oForm = (ARDebitMemo)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }

            try
            {
                ARCreditMemo oForm = (ARCreditMemo)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }
            try
            {
                M_BRND oForm = (M_BRND)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }
            try
            {
                M_KIT oForm = (M_KIT)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }
          
            try
            {
                M_SALESMAN oForm = (M_SALESMAN)this.ActiveMdiChild;
               
                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }
            try
            {
                M_EMPLOYEE oForm = (M_EMPLOYEE)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }

            try
            {
                PhysicalCount oForm = (PhysicalCount)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }

            try
            {
                M_ITEMMASTER oForm = (M_ITEMMASTER)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }

            try
            {
                WHTransferOut oForm = (WHTransferOut)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;

                oForm.ShowSearch();
            }
            catch
            {
            }


            try
            {
                M_ADDRESSBOOK oForm = (M_ADDRESSBOOK)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }

            try
            {
                SalesDelivery oForm = (SalesDelivery)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }
            try
            {
                SalesOrder oForm = (SalesOrder)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }

            try
            {
                SalesReturn oForm = (SalesReturn)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }


            try
            {
                PurchaseRequest oForm = (PurchaseRequest)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }

            try
            {
                PurchaseOrder oForm = (PurchaseOrder)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }
            try
            {
                PurchaseOrderService oForm = (PurchaseOrderService)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }


            try
            {
                GoodsReceivingReport oForm = (GoodsReceivingReport)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }


            try
            {
                GoodsReceipt oForm = (GoodsReceipt)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }

            try
            {
                GoodsIssue oForm = (GoodsIssue)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }

            try
            {
                PurchaseReturn oForm = (PurchaseReturn)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;
                oForm.ShowSearch();
            }
            catch
            {
            }


            try
            {
                CashReceipt oForm = (CashReceipt)this.ActiveMdiChild;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.ConnectionString = this.ConnectionString;

                oForm.ShowSearch();
            }
            catch
            {
            }
            try
            {
                CashDisbursement oForm = (CashDisbursement)this.ActiveMdiChild;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.ConnectionString = this.ConnectionString;

                oForm.ShowSearch();
            }
            catch
            {
            }
           
        }

        private void barFindMini_ItemClick(object sender, ItemClickEventArgs e)
        {
            barSearchDocument_ItemClick(sender, e);
        }
    
        private void barPriceListMenu_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                M_SETUPRICE oPriceList = new M_SETUPRICE();
                oPriceList.ConnectionString = this.ConnectionString;
                oPriceList.MdiParent = this;
                oPriceList.Show();
            }
            catch
            {
            }
        }

        private void barBusinessPartner_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_ADDRESSBOOK oForm = new M_ADDRESSBOOK();
            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;
            oForm.Show();
        }

      
        private void navStockRequest_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            StockRequest oForm = new StockRequest();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void barNewDocument_ItemClick(object sender, ItemClickEventArgs e)
        {

            #region Sales - Account Name
            try
            {
                M_SALESMAN oForm = (M_SALESMAN)this.ActiveMdiChild;

                oForm.Close();
                oForm = new M_SALESMAN();
                oForm.MdiParent = this;
                oForm.ConnectionString = this.ConnectionString;

                oForm.Show();

            }
            catch
            {
            }
                
                
            #endregion 

            #region EMPLOYEE MASTER FILE
            try
            {
                M_EMPLOYEE oForm = (M_EMPLOYEE)this.ActiveMdiChild;

                oForm.Close();
                oForm = new M_EMPLOYEE();
                oForm.MdiParent = this;
                oForm.ConnectionString = this.ConnectionString;

                oForm.Show();

            }
            catch
            {
            }
            #endregion

            #region business partner
            try
            {
                CustomerInfo oForm = (CustomerInfo)this.ActiveMdiChild;

                oForm.Close();
                oForm = new CustomerInfo();
                oForm.MdiParent = this;
                oForm.ConnectionString = this.ConnectionString;

                oForm.Show();

            }
            catch
            {
            }
            try
            {
                M_ADDRESSBOOK oForm = (M_ADDRESSBOOK)this.ActiveMdiChild;

                oForm.Close();
                oForm = new M_ADDRESSBOOK();
                oForm.MdiParent = this;
                oForm.ConnectionString = this.ConnectionString;

                oForm.Show();

            }
            catch
            {
            }
            #endregion

            #region ITEM MASTER
            try
            {
                M_ITEMMASTER oItemMaster = (M_ITEMMASTER)this.ActiveMdiChild;

                oItemMaster.Close();
                oItemMaster = new M_ITEMMASTER();
                oItemMaster.MdiParent = this;
                oItemMaster.ConnectionString = this.ConnectionString;
                oItemMaster.Show();
                
            }
            catch
            {
            }
            #endregion

            #region Inventory
            try
            {
                PhysicalCount oForm = (PhysicalCount)this.ActiveMdiChild;

                oForm.Close();
                oForm = new PhysicalCount();
                oForm.MdiParent = this;
                oForm.ConnectionString = this.ConnectionString;
                oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;

                oForm.Show();

            }
            catch
            {
            }
            try
            {
                WHTransferOut oForm = (WHTransferOut)this.ActiveMdiChild;

                oForm.Close();
                oForm = new WHTransferOut();
                oForm.MdiParent = this;
                oForm.ConnectionString = this.ConnectionString;

                oForm.Show();

            }
            catch
            {
            }
            try
            {
                GoodsReceipt oForm = (GoodsReceipt)this.ActiveMdiChild;
                oForm.Close();
                oForm = new GoodsReceipt();

                oForm.ConnectionString = this.ConnectionString;
                oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
                oForm.DefaultWarehouse = this.DefaultWarehouse;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.MdiParent = this;

                oForm.Show();
            }
            catch
            {
            }
            try
            {
                GoodsIssue oForm = (GoodsIssue)this.ActiveMdiChild;
                oForm.Close();
                oForm = new GoodsIssue();

                oForm.ConnectionString = this.ConnectionString;
                oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
                oForm.DefaultWarehouse = this.DefaultWarehouse;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.MdiParent = this;

                oForm.Show();
            }
            catch
            {
            }
            try
            {
                StockRequest oStockRequest = (StockRequest)this.ActiveMdiChild;

                oStockRequest.Close();
                oStockRequest = new StockRequest();
                oStockRequest.MdiParent = this;
                oStockRequest.ConnectionString = this.ConnectionString;
                oStockRequest.Show();
            }
            catch
            {
            }


            try
            {
                ConsignmentOrder oConsignMentOrder = (ConsignmentOrder)this.ActiveMdiChild;

                oConsignMentOrder.Close();
                oConsignMentOrder = new ConsignmentOrder();
                oConsignMentOrder.MdiParent = this;
                oConsignMentOrder.ActiveUserID = this.ActiveUserID;
                oConsignMentOrder.ConnectionString = this.ConnectionString;
                oConsignMentOrder.Show();
            }
            catch
            {
            }
            #endregion

            #region Sales A/R
            try
            {
                SalesOrder oForm = (SalesOrder)this.ActiveMdiChild;

                oForm.Close();
                oForm = new SalesOrder();
                oForm.MdiParent = this;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
                oForm.DefaultWarehouse = this.DefaultWarehouse;
                oForm.Show();

            }
            catch
            {
            }

            try
            {
                SalesDelivery oForm = (SalesDelivery)this.ActiveMdiChild;

                oForm.Close();
                oForm = new SalesDelivery();
                oForm.MdiParent = this;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
                oForm.DefaultWarehouse = this.DefaultWarehouse;
                oForm.Show();

            }
            catch
            {
            }

            try
            {
                SalesInvoice oForm = (SalesInvoice)this.ActiveMdiChild;

                oForm.Close();
                oForm = new SalesInvoice();
                oForm.MdiParent = this;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
                oForm.DefaultWarehouse = this.DefaultWarehouse;
                oForm.Show();

            }
            catch
            {
            }


            try
            {
                SalesReturn oForm = (SalesReturn)this.ActiveMdiChild;

                oForm.Close();
                oForm = new SalesReturn();
                oForm.MdiParent = this;
                oForm.ConnectionString = this.ConnectionString;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
                oForm.DefaultWarehouse = this.DefaultWarehouse;
                oForm.Show();

            }
            catch
            {
            }
            #endregion

            #region Purchasing A/P

            try
            {
                PurchaseOrder oForm = (PurchaseOrder)this.ActiveMdiChild;
                oForm.Close();
                oForm = new PurchaseOrder();
                oForm.ConnectionString = this.ConnectionString;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.DefaultWarehouse = this.DefaultWarehouse;
                oForm.MdiParent = this; 
                oForm.Show();
            }
            catch
            {
            }

            try
            {
                PurchaseOrderService oForm = (PurchaseOrderService)this.ActiveMdiChild;
                oForm.Close();

                oForm = new PurchaseOrderService();
                oForm.ConnectionString = this.ConnectionString;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.DefaultWarehouse = this.DefaultWarehouse;
                oForm.MdiParent = this;

                oForm.Show();
            }
            catch
            {
            }


            try
            {
                PurchaseReturn oForm = (PurchaseReturn)this.ActiveMdiChild;

                oForm.Close();

                oForm = new PurchaseReturn();
                oForm.ConnectionString = this.ConnectionString;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.DefaultWarehouse = this.DefaultWarehouse;
                oForm.MdiParent = this;

                oForm.Show();
            }
            catch
            {
            }

            try
            {
                GoodsReceivingReport oForm = (GoodsReceivingReport)this.ActiveMdiChild;

                oForm.Close();

                oForm = new GoodsReceivingReport();
                oForm.ConnectionString = this.ConnectionString;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.DefaultWarehouse = this.DefaultWarehouse;
                oForm.MdiParent = this;

                oForm.Show();
            }
            catch
            {
            }
            #endregion

            #region Accounting

            try
            {
                CashReceipt oForm = (CashReceipt)this.ActiveMdiChild;

                oForm = new CashReceipt();

                oForm.ConnectionString = this.ConnectionString;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.MdiParent = this;
                oForm.Show();
            }
            catch
            {
            }

            try
            {
                ARDebitMemo oForm = (ARDebitMemo)this.ActiveMdiChild;

                oForm = new ARDebitMemo();
                oForm.ConnectionString = this.ConnectionString;
                oForm.ActiveUserID = this.ActiveUserID;
                oForm.MdiParent = this;
                oForm.Show();
            }
            catch
            {
            }
            #endregion
        }

        private void navSalesOrder_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            SalesOrder oForm = new SalesOrder();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
            oForm.DefaultWarehouse = this.DefaultWarehouse;
            
            oForm.MdiParent = this;

            oForm.Show();

        }

        private void navDelivery_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            SalesDelivery oDelivery = new SalesDelivery();

            oDelivery.ConnectionString = this.ConnectionString;
            oDelivery.ActiveUserID = this.ActiveUserID;
            oDelivery.DefaultWarehouse = this.DefaultWarehouse;
            oDelivery.IsMultipleWarehouse = this.IsMultipleWarehouse;

            oDelivery.MdiParent = this;

            oDelivery.Show();
        }

        private void barWarehouse_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_WHOUSE oWarehouse = new M_WHOUSE();

            oWarehouse.ConnectionString = this.ConnectionString;
            oWarehouse.MdiParent = this;
            oWarehouse.Show();
        }

        private void navInvGoodsReceipt_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            GoodsReceipt oReceiving = new GoodsReceipt();

            oReceiving.MdiParent = this;

            oReceiving.ConnectionString = this.ConnectionString;
            oReceiving.ActiveUserID = this.ActiveUserID;
            oReceiving.IsMultipleWarehouse = this.IsMultipleWarehouse;
            oReceiving.DefaultWarehouse = this.DefaultWarehouse;
            oReceiving.Show();
        }

        private void navInvGoodsIssue_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

            GoodsIssue oForm = new GoodsIssue();

            oForm.MdiParent = this;
            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUser = this.ActiveUserID;
            oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
            oForm.DefaultWarehouse = this.DefaultWarehouse;
            oForm.ActiveUser = this.ActiveUserID;
            oForm.Show();
        }

        private void navSalesReturn_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            SalesReturn oForm = new SalesReturn();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
            oForm.DefaultWarehouse = this.DefaultWarehouse;

            oForm.MdiParent = this;
            oForm.Show();
        }

        private void barViewSalesOrder_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_SALESORDER oForm = new BRW_SALESORDER();
            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.Department = this.Department;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void barStockInquiry_ItemClick(object sender, ItemClickEventArgs e)
        {
            StockStatus oStockCard = new StockStatus();

            oStockCard.ConnectionString = this.ConnectionString;
            oStockCard.MdiParent = this;
            oStockCard.Show();
        }

        private void navPurchaseRequest_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            PurchaseRequest oPurchaseRequest = new PurchaseRequest();

            oPurchaseRequest.ConnectionString = this.ConnectionString;
            oPurchaseRequest.ActiveUserID = this.ActiveUserID;
            oPurchaseRequest.IsMultipleWarehouse = this.IsMultipleWarehouse;
            oPurchaseRequest.DefaultWarehouse = this.DefaultWarehouse;

            oPurchaseRequest.UserName = this.UserName;
            oPurchaseRequest.Department = this.Department;
            oPurchaseRequest.MdiParent = this;
            oPurchaseRequest.Show();
        }

        private void navPO_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            PurchaseOrder oForm = new PurchaseOrder();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.DefaultWarehouse = this.DefaultWarehouse;
            oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void navGRPO_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            GoodsReceivingReport oForm = new GoodsReceivingReport();

            oForm.ConnectionString = this.ConnectionString;
            oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
            oForm.DefaultWarehouse = this.DefaultWarehouse;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.MdiParent = this;

            oForm.Show();
        }

        private void navPurchaseReturn_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            PurchaseReturn oForm = new PurchaseReturn();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.MdiParent = this;
            oForm.DefaultWarehouse = this.DefaultWarehouse;
            oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
            oForm.Show();
        }

        private void barPR_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_PURCHASEREQUEST oForm = new BRW_PURCHASEREQUEST();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.Department = this.Department;

            oForm.MdiParent = this;
            oForm.Show();
        }

        private void barButtonItem39_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_PURCHASEORDER oForm = new BRW_PURCHASEORDER();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.Department = this.Department;

            oForm.MdiParent = this;
            oForm.Show();
        }

        private void barPurchaseReceipt_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_RECEIVINGREPORT oForm = new BRW_RECEIVINGREPORT();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.Department = this.Department;

            oForm.MdiParent = this;
            oForm.Show();
        }

        private void barPriceList_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_LASTPURPRICE oForm = new BRW_LASTPURPRICE();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.Department = this.Department;

            oForm.MdiParent = this;
            oForm.Show();
        }

        private void barButtonItem50_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_DELIVERIES oForm = new BRW_DELIVERIES();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.Department = this.Department;

            oForm.MdiParent = this;
            oForm.Show(); 
        }

        private void barButtonItem46_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_SALESRETURN oForm = new BRW_SALESRETURN();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.Department = this.Department;

            oForm.MdiParent = this;
            oForm.Show(); 
        }

        private void barButtonItem43_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_IGN oForm = new BRW_IGN();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.Department = this.Department;

            oForm.MdiParent = this;
            oForm.Show(); 
        }

        private void barButtonItem42_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_IGE oForm = new BRW_IGE();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.Department = this.Department;

            oForm.MdiParent = this;
            oForm.Show(); 
        }

        private void barPrintPreview_ItemClick(object sender, ItemClickEventArgs e)
        {

            try
            {
                APVoucherDocument oForm = (APVoucherDocument)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                APCounterDocument oForm = (APCounterDocument)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }


            try
            {
                AcknowledgementReceipt oForm = (AcknowledgementReceipt)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }


            try
            {
                ARDebitMemo oForm = (ARDebitMemo)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                ARCreditMemo oForm = (ARCreditMemo)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                AddressBookList oForm = (AddressBookList)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }
            try
            {
                BRW_PICKLIST oForm = (BRW_PICKLIST)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }
            try
            {
                BRW_AGING oForm = (BRW_AGING)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }
            try
            {
                StockMonitor oForm = (StockMonitor)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                StockStatus oForm = (StockStatus)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }
            try
            {
                BRW_DELIVERIES oForm = (BRW_DELIVERIES)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                BRW_IGE oForm = (BRW_IGE)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                BRW_IGN oForm = (BRW_IGN)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                BRW_LASTPURPRICE oForm = (BRW_LASTPURPRICE)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                BRW_PURCHASEORDER oForm = (BRW_PURCHASEORDER)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                BRW_PURCHASEREQUEST oForm = (BRW_PURCHASEREQUEST)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                BRW_PURCHASERETURN oForm = (BRW_PURCHASERETURN)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                BRW_RECEIVINGREPORT oForm = (BRW_RECEIVINGREPORT)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                BRW_SALESORDER oForm = (BRW_SALESORDER)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                BRW_SALESRETURN oForm = (BRW_SALESRETURN)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }

            try
            {
                BRW_TRANSFER oForm = (BRW_TRANSFER)this.ActiveMdiChild;

                oForm.ConnectionString = this.ConnectionString;

                oForm.PrintPreview();

            }
            catch
            {
            }
            try
            {
                SalesReturn oForm = (SalesReturn)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.PrintPreview();
                oForm.ShowDialog();
            }
            catch
            {
            }
            try
            {
                PhysicalCount oForm = (PhysicalCount)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.PrintPreview();
                oForm.ShowDialog();
            }
            catch
            {
            }
            try
            {
                WHTransferOut oForm = (WHTransferOut)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.PrintPreview();
                oForm.ShowDialog();
            }
            catch
            {
            }
            try
            {
                PurchaseReturn oForm = (PurchaseReturn)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.PrintPreview();
                oForm.ShowDialog();
            }
            catch
            {
            }
            try
            {
                PurchaseOrder oForm = (PurchaseOrder)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.PrintPreview();
                oForm.ShowDialog();
            }
            catch
            {
            }


            try
            {
                PurchaseOrderService oForm = (PurchaseOrderService)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.PrintPreview();
                oForm.ShowDialog();
            }
            catch
            {
            }

            try
            {
                SalesOrder oForm = (SalesOrder)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.PrintPreview();
                oForm.ShowDialog();
            }
            catch
            {
            }
            try
            {
                PurchaseRequest oForm = (PurchaseRequest)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.PrintPreview();
                oForm.ShowDialog();
            }
            catch
            {
            }

            try
            {
                SalesDelivery oForm = (SalesDelivery)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.PrintPreview();
                oForm.ShowDialog();
            }
            catch
            {
            }
            try
            {
                SalesInvoice oForm = (SalesInvoice)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.PrintPreview();
                oForm.ShowDialog();
            }
            catch
            {
            }

            try
            {
                GoodsIssue oForm = (GoodsIssue)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.PrintPreview();
                oForm.ShowDialog();
            }
            catch
            {
            }

            try
            {
                GoodsReceipt oForm = (GoodsReceipt)this.ActiveMdiChild;
                oForm.ConnectionString = this.ConnectionString;
                oForm.PrintPreview();
                oForm.ShowDialog();
            }
            catch
            {
            }

            try
            {
                GoodsReceivingReport oForm = (GoodsReceivingReport)this.ActiveMdiChild;

                
                oForm.ConnectionString = this.ConnectionString;
                oForm.PrintPreview();
                oForm.ShowDialog();
            }
            catch
            {
            }

        }

        private void barStockMonitor_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                StockMonitor oForm = new StockMonitor();

                oForm.MdiParent = this;
                oForm.ConnectionString = this.ConnectionString;
                
                oForm.Show();
            }
            catch
            {
            }
        }

        private void barButtonItem41_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_PURCHASERETURN oForm = new BRW_PURCHASERETURN();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.Department = this.Department;

            oForm.MdiParent = this;
            oForm.Show(); 
        }

        private void barDepartment_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_DEPT oForm = new M_DEPT();

            oForm.ConnectionString = this.ConnectionString;
            
            oForm.MdiParent = this;
            oForm.Show(); 
        }

        
        private void nvaWHTransfer_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            WHTransferOut oForm = new WHTransferOut();

            oForm.ActiveUserID = this.ActiveUserID;
            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void navPhysicalCount_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            PhysicalCount oForm = new PhysicalCount();

            oForm.MdiParent = this;
            oForm.ConnectionString = this.ConnectionString;
            oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
            oForm.DefaultWarehouse = this.DefaultWarehouse;

            oForm.Show();
        }

        private void barEmployees_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_EMPLOYEE oForm = new M_EMPLOYEE();

            oForm.ConnectionString = this.ConnectionString;
            
            oForm.ShowDialog();
        }

        private void barNewMini_ItemClick(object sender, ItemClickEventArgs e)
        {
            barNewDocument_ItemClick(sender, e);
        }

        private void barButtonItem55_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_SALESMAN oForm = new M_SALESMAN();

            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void barWarehouseTransfer_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_TRANSFER oForm = new BRW_TRANSFER();
            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void navWHTransferIn_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            ReceivingTransfer oWhTransferIn = new ReceivingTransfer();

            oWhTransferIn.ConnectionString = this.ConnectionString;
            oWhTransferIn.MdiParent = this;
            oWhTransferIn.Show();

        }

        private void barBrandMaintenance_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_BRND oForm = new M_BRND();
            oForm.ConnectionString = this.ConnectionString;
            
            oForm.ShowDialog();
        }

        private void barBrndCategory_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_BRND_CT oForm = new M_BRND_CT();
            oForm.ConnectionString = this.ConnectionString;
            
            oForm.ShowDialog();
        }

        private void barProduct_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_BRND_CT_PRD oForm = new M_BRND_CT_PRD();
            oForm.ConnectionString = this.ConnectionString;
            
            oForm.ShowDialog();
        }

        private void barVariant_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_BRND_CT_PRD_VAR oForm = new M_BRND_CT_PRD_VAR();
            oForm.ConnectionString = this.ConnectionString;
            
            oForm.ShowDialog();
        }

        private void barProductSize_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_BRND_CT_PRD_VAR_SZE oForm = new M_BRND_CT_PRD_VAR_SZE();
            oForm.ConnectionString = this.ConnectionString;
            
            oForm.ShowDialog();
        }

        private void barWH_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_WHOUSE oWarehouse = new M_WHOUSE();
            oWarehouse.ConnectionString = this.ConnectionString;
            
            oWarehouse.ShowDialog();
        }

        private void barBOM_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_KIT oForm = new M_KIT();

            oForm.ConnectionString = this.ConnectionString;
            //oForm.MdiParent = this;
            oForm.ShowDialog();
        }

        private void barButtonItem5_ItemClick(object sender, ItemClickEventArgs e)
        {
            navBarControl1.Visible = !navBarControl1.Visible;
        }

        private void barButtonItem6_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to close this Application?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                Application.Exit();
            }
        }

        private void barButtonItem7_ItemClick(object sender, ItemClickEventArgs e)
        {
            int iCount = 0;
            foreach (Form oForm in this.MdiChildren)
            {
                iCount = iCount + 1;
            }

            if (iCount > 0)
            {
                if (MessageBox.Show("Are you sure you want to close the unsave documents?", "Log off", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    foreach (Form oForm in this.MdiChildren)
                    {
                        oForm.Close();
                    }
                    Login oLoginForm = LoginWindow;
                    oLoginForm.IsAlreadyOpen = false;
                    oLoginForm.ShowDialog();
                    
                    barStaticCompany.Caption = this.Company;
                    barStaticUser.Caption = "User ID: " + this.ActiveUserID.ToUpper();
                }
            }
            else
            {
                foreach (Form oForm in this.MdiChildren)
                {
                    oForm.Close();
                }
                Login oLoginForm = LoginWindow;
                oLoginForm.IsAlreadyOpen = false;
                LoginWindow.ShowDialog();
                barStaticCompany.Caption = this.Company;
                barStaticUser.Caption = "User ID: " + this.ActiveUserID.ToUpper();

            }
            
        }

        private void barCustomerList_ItemClick(object sender, ItemClickEventArgs e)
        {
            AddressBookList oList = new AddressBookList();
            oList.ConnectionString = this.ConnectionString;
            oList.Text = "Customer List";
            oList.MdiParent = this;
            oList.IsCustomer = true;
            oList.Show();
        }

        private void barVendorList_ItemClick(object sender, ItemClickEventArgs e)
        {
            AddressBookList oList = new AddressBookList();
            oList.ConnectionString = this.ConnectionString;
            oList.Text = "Vendor List";
            oList.MdiParent = this;
            oList.IsCustomer = false;
            oList.Show();
        }

       
        private void barAddUoM_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_ADDUOM oForm = new M_ADDUOM();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ShowDialog();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            ErrMsg.Caption = "";
            ErrMsg.ImageIndex = -1;
            timer1.Enabled = false;
        }

        private void navQAForm_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            BRW_QUARANTINED oForm = new BRW_QUARANTINED();

            oForm.ActiveUserID = this.ActiveUserID;
            oForm.MdiParent = this;
            oForm.ConnectionString = this.ConnectionString;

            oForm.Show();
        }

        private void navORPR_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            CashReceipt oForm = new CashReceipt();

            oForm.ActiveUserID = this.ActiveUserID;
            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;

            oForm.Show();
        }

        private void barAddBank_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_BANK oForm = new M_BANK();

            oForm.ConnectionString = this.ConnectionString;
            
            oForm.ShowDialog();
        }

        private void barAddBankAccount_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_BANK_ACCOUNT oForm = new M_BANK_ACCOUNT();

            oForm.ConnectionString = this.ConnectionString;

            oForm.ShowDialog();
        }

        private void barExpenses_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_EXPENSE oForm = new M_EXPENSE();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ShowDialog();
        }

        private void navARCreditMemo_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            ARCreditMemo oForm = new ARCreditMemo();

            oForm.ActiveUserID = this.ActiveUserID;
            oForm.ConnectionString = this.ConnectionString;

            oForm.MdiParent = this;
            oForm.Show();
        }

        private void barCOA_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_COA oBrowseCOA = new BRW_COA();
            
            oBrowseCOA.MdiParent = this;
            oBrowseCOA.ActiveUserID = this.ActiveUserID;
            oBrowseCOA.ConnectionString = this.ConnectionString;
            oBrowseCOA.Show();
        }

        private void navBarARDebitMemo_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            ARDebitMemo oForm = new ARDebitMemo();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void barAddUser_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_USERMAINTENANCE oUserMaintenance = new M_USERMAINTENANCE();

            oUserMaintenance.ConnectionString = this.ConnectionString;
            oUserMaintenance.ActiveUserID = this.ActiveUserID;
            oUserMaintenance.ShowDialog();
        }

        private void barUserPolicy_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_USERPOLICY oForm = new M_USERPOLICY();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void MainMenu_Shown(object sender, EventArgs e)
        {
           
        }

        private void barGLDetermination_ItemClick(object sender, ItemClickEventArgs e)
        {
            GLDetermination oForm = new GLDetermination();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ShowDialog();
        }

        private void navJournalVoucher_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            JournalVoucher oForm = new JournalVoucher();

            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.Show();
        }

        private void navJournalEntry_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            JournalEntry oJournalEntry = new JournalEntry();

            oJournalEntry.ConnectionString = this.ConnectionString;
            oJournalEntry.ActiveUserID = this.ActiveUserID;
            oJournalEntry.MdiParent = this;
            oJournalEntry.Show();
        }

        private void navDisburse_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            CashDisbursement oForm = new CashDisbursement();

            oForm.ActiveUserID = this.ActiveUserID;
            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;

            oForm.Show();
        }

        private void barReportAndLayoutManager_ItemClick(object sender, ItemClickEventArgs e)
        {
            ReportLayoutManager oForm = new ReportLayoutManager();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ShowDialog();
        }

        private void barCustomerInfo_ItemClick(object sender, ItemClickEventArgs e)
        {
            CustomerInfo oForm = new CustomerInfo();

            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void navConsignmentOrder_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            ConsignmentOrder oForm = new ConsignmentOrder();

            oForm.DefaultWarehouse = this.DefaultWarehouse;
            oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;

            oForm.MdiParent = this;
            oForm.Show();
        }

        private void navConsignmentTransfer_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            ConsignmentTransfer oForm = new ConsignmentTransfer();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.DefaultWarehouse = this.DefaultWarehouse;
            oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;

            oForm.MdiParent = this;
            oForm.Show();
        }

        private void navSalesReport_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Dashboard oForm = new Dashboard();


            oForm.ShowDialog();
        }

        private void barButtonItem20_ItemClick(object sender, ItemClickEventArgs e)
        {
            SETTING_DOCSERIES oForm = new SETTING_DOCSERIES();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ShowDialog();
        }

        private void barPickList_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_PICKLIST oForm = new BRW_PICKLIST();

            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void barBillOfMaterials_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_BOM oForm = new M_BOM();
            oForm.ConnectionString = this.ConnectionString;
            
            oForm.ShowDialog();
        }

        private void navARDebitMemo_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            ARDebitMemo oForm = new ARDebitMemo();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void navARCM_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            ARCreditMemo oForm = new ARCreditMemo();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.MdiParent = this;

            oForm.Show();
        }

        private void barDepartments_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_DEPT oFormDepartment = new M_DEPT();

            oFormDepartment.ConnectionString = this.ConnectionString;
            oFormDepartment.ShowDialog();
        }

        private void barDivision_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_DIVISION oForm = new M_DIVISION();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ShowDialog();
        }

        private void barMachineUnit_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_ENTITIES oForm = new M_ENTITIES();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ShowDialog();
        }

        private void navBarCounterRR_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            APCounterDocument oForm = new APCounterDocument();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserId = this.ActiveUserID;
            oForm.MdiParent = this;

            oForm.Show();
        }

        private void navServiceAckRcpt_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            AcknowledgementReceipt oForm = new AcknowledgementReceipt();

            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;
            oForm.ActiveUserID = this.ActiveUserID;
            oForm.Show();
        }

        private void barAcknowledgementReceipt_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_SERVICE_RECEIPT oForm = new BRW_SERVICE_RECEIPT();

            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void barPOService_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_PO_SERVICE oForm = new BRW_PO_SERVICE();

            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void navAPVoucher_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            APVoucherDocument oForm = new APVoucherDocument();

            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;

            oForm.Show();
        }

        private void barCheckClearing_ItemClick(object sender, ItemClickEventArgs e)
        {
            BRW_CASHRECEIPT_CLEARING oForm = new BRW_CASHRECEIPT_CLEARING();

            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;

            oForm.Show();
        }

        private void barCardDocument_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_CardDocument oForm = new M_CardDocument();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ShowDialog();
        }

        private void navBarDashboards_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Dashboard oForm = new Dashboard();
            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParent = this;
            oForm.Show();
            
        }

        private void navBarCheckClearing_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            BRW_CASHRECEIPT_CLEARING oFormCheckClearing = new BRW_CASHRECEIPT_CLEARING();

            oFormCheckClearing.ConnectionString = this.ConnectionString;
            oFormCheckClearing.MdiParent = this;
            oFormCheckClearing.Show();
        }

        private void barItemDivision_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_ITEMDIVISION oForm = new M_ITEMDIVISION();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ShowDialog();
        }

        private void barButtonItem5_ItemClick_1(object sender, ItemClickEventArgs e)
        {
            M_ITEMCATEGORY oForm = new M_ITEMCATEGORY();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ShowDialog();
        }

        private void barButtonItem29_ItemClick(object sender, ItemClickEventArgs e)
        {
            M_ITEMCLASS oForm = new M_ITEMCLASS();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ShowDialog();
        }

        private void barAR_AgingReport_ItemClick(object sender, ItemClickEventArgs e)
        {
            CRYSTAL_AR_AGING_PARAM oForm = new CRYSTAL_AR_AGING_PARAM();

            oForm.ConnectionString = this.ConnectionString;
            oForm.MdiParentForm = this;
            oForm.ShowDialog();
        }

        private void barStockMovement_ItemClick(object sender, ItemClickEventArgs e)
        {
            CRYSTAL_STOCKMOVEMENT_PARAM oForm = new CRYSTAL_STOCKMOVEMENT_PARAM();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ShowDialog();
        }

        private void barReportManager_ItemClick(object sender, ItemClickEventArgs e)
        {
            ReportConfiguration oForm = new ReportConfiguration();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ShowDialog();
        }

        private void navManuOrder_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            ManufacturingOrder oForm = new ManufacturingOrder();

            oForm.ConnectionString = this.ConnectionString;
            oForm.ActiveUserId = this.ActiveUserID;
            oForm.MdiParent = this;
            oForm.Show();
        }

        private void navMRP_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            ManufacturingTestRun oForm = new ManufacturingTestRun();

            oForm.MdiParent = this;
            oForm.Show();
        }

        private void navInvoice_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            SalesInvoice oForm = new SalesInvoice();

            oForm.ActiveUserID = this.ActiveUserID;
            oForm.ConnectionString = this.ConnectionString;
            oForm.IsMultipleWarehouse = this.IsMultipleWarehouse;
            oForm.MdiParent = this;

            oForm.Show();
        }


    }
}

